<style>
ul{ margin:0; padding:0;}
li{ list-style-type:none; float:left; border:#CCC 1px solid; margin:0 5px 5px 0; padding:5px; text-align:center;}
li input{margin:0 0 5px 0; padding:0;}
</style>
<script>
function callParent(picname){
	var picname;
	//alert(picname);
	parent.InsertHTML(""+picname+""); 
	}
</script>
<?
if(isset($_GET[del])){
		unlink('../msgbox/saved/'.$_GET[del]); 
	}
?>
<ul>
<?
$d = dir("../msgbox/saved");
while (false !== ($entry = $d->read())) {
	if($entry<>'.' and $entry<>'..'){
		//echo '<li><div><input onclick="callParent(\''.$entry.'\')" type="button" value="插入" /><input onClick="if(confirm(\'删除后不能恢复，确定吗？\')) location=\'?del='.$entry.'\'" type="button" value="删除" /></div><img style="margin: 5px; vertical-align: middle; height: 100px;" src="../msgbox/saved/'.$entry.'" /></li>';
		$array.='"'.$entry.'",';
		}
   
}

eval('$array=array('.substr($array,0,-1).');');
arsort ($array);
foreach($array as $entry){
	echo '<li><div><input onclick="callParent(\''.$entry.'\')" type="button" value="插入" /><input onClick="if(confirm(\'删除后不能恢复，确定吗？\')) location=\'?del='.$entry.'\'" type="button" value="删除" /></div><img style="margin: 5px; vertical-align: middle; height: 100px;" src="../msgbox/saved/'.$entry.'" /></li>';
	}
?></ul>